/**************************************************************************
*   Copyleft 2009 by        											  *
*	Iwanicki Krzysztof													  *
*   <www.gamma.mini.pw.edu.pl/~iwanickik>		                          *
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*                                                                         *
*   This program is distributed in the hope that it will be useful,       *
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
*   GNU General Public License for more details.                          *
***************************************************************************/
#ifndef __VFRUSTUM_H__
#define __VFRUSTUM_H__

#include "Math/vMath.h"
#include "../../Macros/vMemoryMacros.h"

namespace Vendetta {

	/*! \class vFrustum
	 *  \brief A vFrustum class used for frustum culling.
	 *
	 */
	class vFrustum {
	public:
		static enum {
			VTOP = 0,
			VBOTTOM = 1,
			VLEFT = 2,
			VRIGHT = 3,
			VNEAR = 4,
			VFAR = 5
		};
	public:
		/*! \brief Default constructor.
		 *
		 */	
		vFrustum();

		/*! \brief Copy constructor.
		 *
		 */	
		vFrustum(const vFrustum& frustum);

		/*! \brief Destructor.
		 *
		 */	
		virtual ~vFrustum();

		/*! \brief Assign operator.
		 *
		 */	
		vFrustum& operator=(const vFrustum& frustum);

		/*! \brief Pure virtual method for extracting frustum information.
		 *
		 *	Note:	Each API should implement this class for frustum culling.
		 *	
		 */	
		virtual vVoid Extract() = 0;

		/*! \brief Tests whether vAxisAlignedBoundingBox is inside frustum.
		 *
		 *
		 *	\param	aabb	Axis aligned bounding box to test for.
		 *	\return	vBool	True if aabb is inside frustum, false otherwise.
		 *	\sa		vAxisAlignedBoundingBox.
		 */	
		virtual vBool IsInFrustum(const vAxisAlignedBoundingBox& aabb);

		/*! \brief Tests whether vSphere is inside frustum.
		 *
		 *
		 *	\param	sphere	Sphere to test for.
		 *	\return	vBool	True if sphere is inside frustum, false otherwise.
		 *	\sa		vSphere.
		 */	
		virtual vBool IsInFrustum(const vSphere& sphere);

		/*! \brief Tests whether vPoint3D is inside frustum.
		 *
		 *
		 *	\param	point	vPoint3D to test for.
		 *	\return	vBool	True if point is inside frustum, false otherwise.
		 *	\sa		vSphere.
		 */	
		virtual vBool IsInFrustum(const vPoint3D& point);

	protected:
		vPlane mPlanes[6];
	
	};
}

#endif // __VFRUSTUM_H__